package com.csxy.xxm.controller;

import com.csxy.xxm.R;
import com.csxy.xxm.service.StatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/staservice/daily")
public class StatisticsController {

    @Autowired
    private StatisticsService statisticsService;
    //    统计某一天人数
    @PostMapping("/createStatisticsByDay/{day}")
    public R createStatisticsByDay(@PathVariable String day){
        statisticsService.createStatisticsByDay(day);
        return R.ok();
    }
    //    图表显示
    @GetMapping("/showData/{type}/{begin}/{end}")
    public R showData(@PathVariable String type,@PathVariable String begin,@PathVariable String end){
        Map<String,Object> map = statisticsService.getShowData(type,begin,end);
        return R.ok().data(map);
    }
}
